<template>
  <div>
    <van-nav-bar title="搜索" left-text="返回" left-arrow @click-left="onClickLeft" />
    <div class="box">
      <div v-for="item in list" :key="item.goods_id" class="smallbox">
        <img :src="item.img_big_logo" alt="" class="img" @click="detail(item)" />
        <div class="van-multi-ellipsis--l2">
          <h2>{{ item.title }}</h2>
        </div>

        <p style="color: red">{{ item.current_price }}</p>
      </div>
    </div>
  </div>
</template>
<script>
export default {
  methods: {
    onClickLeft() {
      this.$router.back()
    },
    detail(item) {
      this.$router.push({
        path: '/detail',
        query: { id: item.goods_id }
      })
    }
  },
  data() {
    return {
      list: []
    }
  },
  mounted() {
    this.list = JSON.parse(this.$route.query.list)
    console.log(this.list)
  }
}
</script>
<style lang="scss">
.box {
  width: 100%;
  height: 100%;
  box-sizing: border-box;
  padding-top: 10px;
  display: flex;
  flex-direction: row;
  flex-wrap: wrap;
  gap: 20px;
  justify-content: space-evenly;
}
.smallbox {
  width: 160px;
}
.img {
  width: 100%;
}
</style>
